from django.db import models

class Music(models.Model):
	class Meta:
		verbose_name=verbose_name_plural='Music'
	title = models.CharField(
			verbose_name='Tile',
			max_length=100
			)
	def __str__(self):
		return self.title
	comment= models.TextField(
			verbose_name='Comment',
			max_length=5000,
			null=True, blank=True
			)
class Range(models.Model):
	class Meta:
		verbose_name=verbose_name_plural='Music Range'
	date_start=models.DateField(
			verbose_name='Start date of listening'
			)
	date_stop=models.DateField(
			verbose_name='Stop date of listening',
			null=True, blank=True
			)
	music = models.ForeignKey(Music)
	def still_on_player(self):
		if not self.date_stop:
			return 'Yes'
		return 'No'
	still_on_player.short_description = 'Still on music player'
